﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace lok3_map_builder
{
    class ProgressBar
    {
        public int X {get; set;}
        public int Y {get; set;}
        public int Width {get; set;}
        public int Height {get; set;}
        public Color BarColor {get; set;}
        public Color FrameColor {get; set;}
        public float progress { get; set; }
        
        private GraphicsDevice _gd;
        private SpriteBatch _sb;

        public ProgressBar(GraphicsDevice gd, SpriteBatch sb, int x, int y, int width, int height) : this(gd, sb, x, y, width, height, Color.Blue, Color.Black) {}
        public ProgressBar(GraphicsDevice gd, SpriteBatch sb, int x, int y, int width, int height, Color barColor, Color bgColor)
        {
            X = x;
            Y = y;
            Width = width;
            Height = height;
            BarColor = barColor;
            FrameColor = bgColor;
            progress = 0;
            _gd = gd;
            _sb = sb;
        }

        public void Draw()
        {
            //Box frame = new Box(_gd, _sb, X, Y - 2, X + Width + 4, Y + Height + 4, 2, Color.Black, FrameColor);
            //frame.HasBox = false;
            //frame.Draw();

            Box bar = new Box(_gd, _sb, X, Y, (int)(Width * progress), Height, 1, BarColor, Color.Black);
            
            bar.HasFrame = false;
            bar.Draw();
            if ((int)((float)(X + Width) * progress) > 0)
            {
                int a = 1;
            }
            
        }
    }
}
